#ifndef WF_DIMLINEAR_H
#define WF_DIMLINEAR_H

#include "wf_dimension.h"
#include "pf_dimlinear.h"
#include "gui_export.h"

/**
 * This action class can handle user events to draw 
 * aligned dimensions.
 *
 */
class GUI_EXPORT WF_DimLinear : public WF_Dimension {
	Q_OBJECT
public:
	/**
	 * Varitions of this action.
	 */
	enum Variation {
		AnyAngle,
		Horizontal,
		Vertical
	};
	 
    /**
     * Action States.
     */
    enum Status {
        SetExtPoint1,    /**< Setting the 1st ext point.  */
        SetExtPoint2,    /**< Setting the 2nd ext point. */
        SetDefPoint,     /**< Setting the common def point. */
		SetText,         /**< Setting the text label in the command line. */
		SetAngle         /**< Setting the angle in the command line. */
    };

public:
    WF_DimLinear(PF_Container& container,
                       PF_GraphicView& graphicView,
                       double angle=0.0, bool fixedAngle=false);
    ~WF_DimLinear();
	
	static QAction* createGUIAction(LX_Define::ActionType type, QObject* /*parent*/);
	
	virtual LX_Define::ActionType rtti() {
		return LX_Define::ActionDimLinear;
	}

    void reset();

    virtual void trigger();
	void preparePreview();
	
    virtual void mouseMoveEvent(QMouseEvent* e);
    virtual void mouseReleaseEvent(QMouseEvent* e);

	virtual void coordinateEvent(PF_CoordinateEvent* e);
    virtual void commandEvent(PF_CommandEvent* e);
        virtual QStringList getAvailableCommands();
	
    virtual void hideOptions();
    virtual void showOptions();
	
    virtual void updateMouseButtonHints();

	double getAngle() {
		return edata.angle;
	}

	void setAngle(double a) {
		edata.angle = a;
	}

	bool hasFixedAngle() {
		return fixedAngle;
	}

protected:
    /**
     * Aligned dimension data.
     */
    PF_DimLinearAttribute edata;
    /**
     * Is the angle fixed?
     */
    bool fixedAngle;

	/** Last status before entering text or angle. */
	Status lastStatus;
};

#endif
